using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Camera))]
public class lwRatioAdapter : MonoBehaviour {

	public static float s_DefaultSize = 384.0f;
	public static float s_DefaultRatio = 1024.0f/768.0f;

	private float m_fScreenW = 0.0f;
	private float m_fScreenH = 0.0f;

	private Camera m_Camera = null;

	void Awake()
	{
		m_Camera = GetComponent<Camera>();
		
		m_fScreenW = Screen.width;
		m_fScreenH = Screen.height;
		float fScreenRatio = m_fScreenW/m_fScreenH;
		if (fScreenRatio < s_DefaultRatio)
			m_Camera.orthographicSize = (s_DefaultRatio / fScreenRatio) * s_DefaultSize;
		else
			m_Camera.orthographicSize = s_DefaultSize;
	}
}
